package 容器.main.java.com.itheima;

import com.itheima.dao.BookDao;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

/**
 * 创建容器的两种方式
 */

public class App {
    public static void main(String[] args) {
        //1.加载类路径下的配置文件
        ApplicationContext IOC=new ClassPathXmlApplicationContext("applicationContext.xml","applicationContext.xm");
        //2.从文件系统下加载配置文件
        ApplicationContext IOC1=new FileSystemXmlApplicationContext("F:\\environment\\md笔记\\java学习路线\\SSM\\01-spring\\01-spring\\day02\\代码\\spring\\spring_10_container\\src\\main\\resources\\applicationContext.xml");

        //3.加载多个配置文件
        ApplicationContext IOC3=new ClassPathXmlApplicationContext("applicationContext.xml","applicationContext.xm");

        BookDao bookDao = (BookDao) IOC.getBean("bookDao");
        System.out.println(bookDao);
        BookDao bookDao1 = (BookDao) IOC1.getBean("bookDao");
        System.out.println(bookDao1);


    }
}
